package com.nervenets.template.hibernate.domain.common;

import com.nervenets.general.annotation.DataUniquenessField;
import com.nervenets.general.hibernate.TreeDomainObject;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

@ApiModel("字典表")
@Entity
@Table(name = "sys_dict", indexes = {
        @Index(name = "idx_of_code", columnList = "code"),
        @Index(name = "idx_of_parentId", columnList = "parentId")
})
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class Dict extends TreeDomainObject<Dict> {
    public final static String CACHE_KEY = "DICT";
    @ApiModelProperty("编码")
    @DataUniquenessField
    @Column(columnDefinition = "varchar(140) DEFAULT NULL COMMENT '编码'")
    private String code;
    @ApiModelProperty("值")
    @Column(columnDefinition = "varchar(140) DEFAULT NULL COMMENT '值'")
    private String val;
    @ApiModelProperty("备注")
    private String remark;
    @ApiModelProperty("描述")
    private String detail;
}
